#include "scene_logic_handle.h"

static SCENE_LOACL_DATA temp_scene_config;

void sence_mode1_handle(); //场景子模式1
void sence_mode2_handle(); //场景子模式2
void sence_mode3_handle(); //场景子模式3
void sence_mode4_handle(); //场景子模式1
void sence_mode5_handle(); //场景子模式1
void sence_mode6_handle(); //场景子模式1
void sence_mode7_handle(); //场景子模式1
void sence_mode8_handle(); //场景子模式1
void sence_mode9_handle(); //场景子模式1
void sence_mode10_handle(); //场景子模式1
void sence_mode11_handle(); //场景子模式1
void sence_mode12_handle(); //场景子模式1

void sence_group_mode1_handle(); //组合场景1
void sence_group_mode2_handle(); //组合场景2
void sence_group_mode3_handle(); //组合场景3
void sence_group_mode4_handle(); //组合场景4
void sence_group_mode5_handle(); //组合场景5
void sence_group_mode6_handle(); //组合场景6
void sence_group_mode7_handle(); //组合场景7
void sence_group_mode8_handle(); //组合场景8
void sence_group_mode9_handle(); //组合场景9
void sence_group_mode10_handle(); //组合场景10
void sence_group_mode11_handle(); //组合场景11
void sence_group_mode12_handle(); //组合场景12



SCENE_HANDLE scene_mode_dazzling_handle[SCENE_MODE_NUM] =
{
    {}, //0号
    {sence_mode1_handle}, //1 
    {sence_mode2_handle}, //2
    {sence_mode3_handle},//3
    {sence_mode4_handle}, //4
    {sence_mode5_handle},//5
    {sence_mode6_handle},//6
    {sence_mode7_handle},//7
    {sence_mode8_handle},//8
    {sence_mode9_handle},//9
    {sence_mode10_handle},//10
    {sence_mode11_handle},//11
    {sence_mode12_handle},//12
    {sence_group_mode1_handle}, //组合场景1
    {sence_group_mode2_handle}, //组合场景2
    {sence_group_mode3_handle}, //组合场景3
    {sence_group_mode4_handle}, //组合场景4
    {sence_group_mode5_handle}, //组合场景5
    {sence_group_mode6_handle}, //组合场景6
    {sence_group_mode7_handle}, //组合场景7
    {sence_group_mode8_handle}, //组合场景8
    {sence_group_mode9_handle}, //组合场景9
    {sence_group_mode10_handle}, //组合场景10
    {sence_group_mode11_handle}, //组合场景11
    {sence_group_mode12_handle}, //组合场景12

};

void scene_mode_handle()
{
    if(scene_mode_dazzling_handle[get_scene_ssp()].handle)
    {
        scene_mode_dazzling_handle[get_scene_ssp()].handle();
    }
}

void scene_logic_handle(SYS_OPT_KEY opt)
{
    static int time;
    if (app_logic_get_last_ssp() != app_logic_get_ssp()) //第一次进入
    {

        LOG_INFO("scene_logic_handle\n");

        disp_clear_light1(); //清除原有灯效
        disp_clear_light2(); //清楚原有的灯效
        disp_clear_cw_light(); //清除cw原有灯效

        app_logic_set_last_ssp(app_logic_get_ssp());

    }

    scene_mode_handle();//场景处理函数

    if (opt.oepation== OPT_POWER_TURNOFF) //关机
    {
        app_logic_set_ssp(SSP_POWER_OFF);
    }
    else if (opt.oepation == OPT_GO_NEXT) //下一个场景
    {
        if ((get_scene_ssp()+1)<=MODE12) //不能超过存储的场景总数
        {
            set_scene_ssp(get_scene_ssp()+1);
        }
        else
        {
            set_scene_ssp(MODE1);
        }
    }
    else if(opt.oepation == OPT_GO_MIC) //进入麦克风模式
    {
        app_logic_set_ssp(SSP_MODE_MIC);
    }
    else if(opt.oepation == OPT_GO_CW) //进入CW模式
    {
        app_logic_set_ssp(SSP_MODE_CW);
    }
}


void sence_mode1_handle()
{
    static int time= 0;
    static u16 logo_cnt; //读取的总计数量
    static u16 cnt; //计数器
    static u8 frame_num; //帧数
    u8 buf[BUF_SIZE]; //临时存储空间

    if (get_scene_last_ssp() != get_scene_ssp())
    {
        LOG_INFO("Into sence_mode1_handle()\n");
        set_scene_last_ssp(get_scene_ssp());
        if(read_partition(MODE1_DATA+CNT_OFFEST,&logo_cnt,sizeof(u16)) == ESP_OK)
        {
            LOG_INFO("mode1 logo_cnt is %d\n",logo_cnt);
            if(read_partition(MODE1_DATA+FRAME_NUM,&frame_num,sizeof(u8)) == ESP_OK)
            {
                LOG_INFO("read mode1 frame num is %d\n",frame_num);

            }
            else
            {
                LOG_ERROR("mode1 frame read err\n");
            }
        }
        else
        {
            LOG_ERROR("mode1 cnt read err\n");
        }
        time = arch_os_ms_now();
        cnt =0;
    }

    if (arch_os_ms_elapsed(time)>=(1000/frame_num))
    {
        time = arch_os_ms_now();
        bzero(buf,BUF_SIZE);
        if (read_partition(MODE1_DATA+DATA_ADDR+cnt*get_color_length(),buf,get_color_length())==ESP_OK) //正确读取数据
        {
             disp_light_handle(buf);
        }
        cnt++;
    }
    

    if (cnt>=(logo_cnt-1))
    {
       cnt=0; //计数器清零
    }
    
}

void sence_mode2_handle()
{
    static int time= 0;
    static u16 logo_cnt; //读取的总计数量
    static u16 cnt; //计数器
    static u8 frame_num; //帧数
    u8 buf[BUF_SIZE]; //临时存储空间
    if (get_scene_last_ssp() != get_scene_ssp())
    {
        LOG_INFO("Into sence_mode2_handle()\n");
        set_scene_last_ssp(get_scene_ssp());
        if(read_partition(MODE2_DATA+CNT_OFFEST,&logo_cnt,sizeof(u16)) == ESP_OK)
        {
            LOG_INFO("mode2 logo_cnt is %d\n",logo_cnt);
            if(read_partition(MODE2_DATA+FRAME_NUM,&frame_num,sizeof(u8)) == ESP_OK)
            {
                LOG_INFO("read mode2 frame num is %d\n",frame_num);

            }
            else
            {
                LOG_ERROR("mode2 frame read err\n");
            }
        }
        else
        {
            LOG_ERROR("mode2 cnt read err\n");
        }
        time = arch_os_ms_now();
        cnt =0;
    }

    if (arch_os_ms_elapsed(time)>=(1000/frame_num))
    {
        time = arch_os_ms_now();
        bzero(buf,BUF_SIZE);
        if (read_partition(MODE2_DATA+DATA_ADDR+cnt*get_color_length(),buf,get_color_length())==ESP_OK) //正确读取数据
        {
             disp_light_handle(buf);
        }
        cnt++;
    }
    

    if (cnt>=(logo_cnt-1))
    {
       cnt=0; //计数器清零
    }
}

void sence_mode3_handle()
{
    static int time= 0;
    static u16 logo_cnt; //读取的总计数量
    static u16 cnt; //计数器
    static u8 frame_num; //帧数
    u8 buf[BUF_SIZE]; //临时存储空间
    if (get_scene_last_ssp() != get_scene_ssp())
    {
        LOG_INFO("Into sence_mode3_handle()\n");
        set_scene_last_ssp(get_scene_ssp());
        if(read_partition(MODE3_DATA+CNT_OFFEST,&logo_cnt,sizeof(u16)) == ESP_OK)
        {
            LOG_INFO("mode3 logo_cnt is %d\n",logo_cnt);
            if(read_partition(MODE3_DATA+FRAME_NUM,&frame_num,sizeof(u8)) == ESP_OK)
            {
                LOG_INFO("read mode3 frame num is %d\n",frame_num);

            }
            else
            {
                LOG_ERROR("mode3 frame read err\n");
            }
        }
        else
        {
            LOG_ERROR("mode3 cnt read err\n");
        }
        time = arch_os_ms_now();
        cnt =0;
    }

    if (arch_os_ms_elapsed(time)>=(1000/frame_num))
    {
        time = arch_os_ms_now();
        bzero(buf,BUF_SIZE);
        if (read_partition(MODE3_DATA+DATA_ADDR+cnt*get_color_length(),buf,get_color_length())==ESP_OK) //正确读取数据
        {
             disp_light_handle(buf);
        }
        cnt++;
    }

    if (cnt>=(logo_cnt-1))
    {
       cnt=0; //计数器清零
    }
}

void sence_mode4_handle()
{
    static int time= 0;
    static u16 logo_cnt; //读取的总计数量
    static u16 cnt; //计数器
    static u8 frame_num; //帧数
    u8 buf[BUF_SIZE]; //临时存储空间
    if (get_scene_last_ssp() != get_scene_ssp())
    {
        LOG_INFO("Into sence_mode4_handle()\n");
        set_scene_last_ssp(get_scene_ssp());
        if(read_partition(MODE4_DATA+CNT_OFFEST,&logo_cnt,sizeof(u16)) == ESP_OK)
        {
            LOG_INFO("mode4 logo_cnt is %d\n",logo_cnt);
            if(read_partition(MODE4_DATA+FRAME_NUM,&frame_num,sizeof(u8)) == ESP_OK)
            {
                LOG_INFO("read mode4 frame num is %d\n",frame_num);

            }
            else
            {
                LOG_ERROR("mode4 frame read err\n");
            }
        }
        else
        {
            LOG_ERROR("mode4 cnt read err\n");
        }
        time = arch_os_ms_now();
        cnt =0;
    }

    if (arch_os_ms_elapsed(time)>=(1000/frame_num))
    {
        time = arch_os_ms_now();
        bzero(buf,BUF_SIZE);
        if (read_partition(MODE4_DATA+DATA_ADDR+cnt*get_color_length(),buf,get_color_length())==ESP_OK) //正确读取数据
        {
             disp_light_handle(buf);
        }
        cnt++;
    }

    if (cnt>=(logo_cnt-1))
    {
       cnt=0; //计数器清零
    }
}

void sence_mode5_handle()
{
    static int time= 0;
    static u16 logo_cnt; //读取的总计数量
    static u16 cnt; //计数器
    static u8 frame_num; //帧数
    u8 buf[BUF_SIZE]; //临时存储空间
    if (get_scene_last_ssp() != get_scene_ssp())
    {
        LOG_INFO("Into sence_mode5_handle()\n");
        set_scene_last_ssp(get_scene_ssp());
        if(read_partition(MODE5_DATA+CNT_OFFEST,&logo_cnt,sizeof(u16)) == ESP_OK)
        {
            LOG_INFO("mode5 logo_cnt is %d\n",logo_cnt);
            if(read_partition(MODE5_DATA+FRAME_NUM,&frame_num,sizeof(u8)) == ESP_OK)
            {
                LOG_INFO("read mode5 frame num is %d\n",frame_num);

            }
            else
            {
                LOG_ERROR("mode5 frame read err\n");
            }
        }
        else
        {
            LOG_ERROR("mode5 cnt read err\n");
        }
        time = arch_os_ms_now();
        cnt =0;
    }

    if (arch_os_ms_elapsed(time)>=(1000/frame_num))
    {
        time = arch_os_ms_now();
        bzero(buf,BUF_SIZE);
        if (read_partition(MODE5_DATA+DATA_ADDR+cnt*get_color_length(),buf,get_color_length())==ESP_OK) //正确读取数据
        {
             disp_light_handle(buf);
        }
        cnt++;
    }

    if (cnt>=(logo_cnt-1))
    {
       cnt=0; //计数器清零
    }
}

void sence_mode6_handle()
{
    static int time= 0;
    static u16 logo_cnt; //读取的总计数量
    static u16 cnt; //计数器
    static u8 frame_num; //帧数
    u8 buf[BUF_SIZE]; //临时存储空间
    if (get_scene_last_ssp() != get_scene_ssp())
    {
        LOG_INFO("Into sence_mode6_handle()\n");
        set_scene_last_ssp(get_scene_ssp());
        if(read_partition(MODE6_DATA+CNT_OFFEST,&logo_cnt,sizeof(u16)) == ESP_OK)
        {
            LOG_INFO("mode6 logo_cnt is %d\n",logo_cnt);
            if(read_partition(MODE6_DATA+FRAME_NUM,&frame_num,sizeof(u8)) == ESP_OK)
            {
                LOG_INFO("read mode6 frame num is %d\n",frame_num);

            }
            else
            {
                LOG_ERROR("mode6 frame read err\n");
            }
        }
        else
        {
            LOG_ERROR("mode6 cnt read err\n");
        }
        time = arch_os_ms_now();
        cnt =0;
    }

    if (arch_os_ms_elapsed(time)>=(1000/frame_num))
    {
        time = arch_os_ms_now();
        bzero(buf,BUF_SIZE);
        if (read_partition(MODE6_DATA+DATA_ADDR+cnt*get_color_length(),buf,get_color_length())==ESP_OK) //正确读取数据
        {
             disp_light_handle(buf);
        }
        cnt++;
    }

    if (cnt>=(logo_cnt-1))
    {
       cnt=0; //计数器清零
    }
}

void sence_mode7_handle()
{
    static int time= 0;
    static u16 logo_cnt; //读取的总计数量
    static u16 cnt; //计数器
    static u8 frame_num; //帧数
    u8 buf[BUF_SIZE]; //临时存储空间
    if (get_scene_last_ssp() != get_scene_ssp())
    {
        LOG_INFO("Into sence_mode7_handle()\n");
        set_scene_last_ssp(get_scene_ssp());
        if(read_partition(MODE7_DATA+CNT_OFFEST,&logo_cnt,sizeof(u16)) == ESP_OK)
        {
            LOG_INFO("mode7 logo_cnt is %d\n",logo_cnt);
            if(read_partition(MODE7_DATA+FRAME_NUM,&frame_num,sizeof(u8)) == ESP_OK)
            {
                LOG_INFO("read mode7 frame num is %d\n",frame_num);

            }
            else
            {
                LOG_ERROR("mode7 frame read err\n");
            }
        }
        else
        {
            LOG_ERROR("mode7 cnt read err\n");
        }
        time = arch_os_ms_now();
        cnt =0;
    }

    if (arch_os_ms_elapsed(time)>=(1000/frame_num))
    {
        time = arch_os_ms_now();
        bzero(buf,BUF_SIZE);
        if (read_partition(MODE7_DATA+DATA_ADDR+cnt*get_color_length(),buf,get_color_length())==ESP_OK) //正确读取数据
        {
             disp_light_handle(buf);
        }
        cnt++;
    }

    if (cnt>=(logo_cnt-1))
    {
       cnt=0; //计数器清零
    }
}

void sence_mode8_handle()
{
    static int time= 0;
    static u16 logo_cnt; //读取的总计数量
    static u16 cnt; //计数器
    static u8 frame_num; //帧数
    u8 buf[BUF_SIZE]; //临时存储空间
    if (get_scene_last_ssp() != get_scene_ssp())
    {
        LOG_INFO("Into sence_mode8_handle()\n");
        set_scene_last_ssp(get_scene_ssp());
        if(read_partition(MODE8_DATA+CNT_OFFEST,&logo_cnt,sizeof(u16)) == ESP_OK)
        {
            LOG_INFO("mode8 logo_cnt is %d\n",logo_cnt);
            if(read_partition(MODE8_DATA+FRAME_NUM,&frame_num,sizeof(u8)) == ESP_OK)
            {
                LOG_INFO("read mode8 frame num is %d\n",frame_num);

            }
            else
            {
                LOG_ERROR("mode8 frame read err\n");
            }
        }
        else
        {
            LOG_ERROR("mode8 cnt read err\n");
        }
        time = arch_os_ms_now();
        cnt =0;
    }

    if (arch_os_ms_elapsed(time)>=(1000/frame_num))
    {
        time = arch_os_ms_now();
        bzero(buf,BUF_SIZE);
        if (read_partition(MODE8_DATA+DATA_ADDR+cnt*get_color_length(),buf,get_color_length())==ESP_OK) //正确读取数据
        {
             disp_light_handle(buf);
        }
        cnt++;
    }

    if (cnt>=(logo_cnt-1))
    {
       cnt=0; //计数器清零
    }
}

void sence_mode9_handle()
{
    static int time= 0;
    static u16 logo_cnt; //读取的总计数量
    static u16 cnt; //计数器
    static u8 frame_num; //帧数
    u8 buf[BUF_SIZE]; //临时存储空间
    if (get_scene_last_ssp() != get_scene_ssp())
    {
        LOG_INFO("Into sence_mode9_handle()\n");
        set_scene_last_ssp(get_scene_ssp());
        if(read_partition(MODE9_DATA+CNT_OFFEST,&logo_cnt,sizeof(u16)) == ESP_OK)
        {
            LOG_INFO("mode9 logo_cnt is %d\n",logo_cnt);
            if(read_partition(MODE9_DATA+FRAME_NUM,&frame_num,sizeof(u8)) == ESP_OK)
            {
                LOG_INFO("read mode9 frame num is %d\n",frame_num);

            }
            else
            {
                LOG_ERROR("mode9 frame read err\n");
            }
        }
        else
        {
            LOG_ERROR("mode9 cnt read err\n");
        }
        time = arch_os_ms_now();
        cnt =0;
    }

    if (arch_os_ms_elapsed(time)>=(1000/frame_num))
    {
        time = arch_os_ms_now();
        bzero(buf,BUF_SIZE);
        if (read_partition(MODE9_DATA+DATA_ADDR+cnt*get_color_length(),buf,get_color_length())==ESP_OK) //正确读取数据
        {
             disp_light_handle(buf);
        }
        cnt++;
    }

    if (cnt>=(logo_cnt-1))
    {
       cnt=0; //计数器清零
    }
}

void sence_mode10_handle()
{
    static int time= 0;
    static u16 logo_cnt; //读取的总计数量
    static u16 cnt; //计数器
    static u8 frame_num; //帧数
    u8 buf[BUF_SIZE]; //临时存储空间
    if (get_scene_last_ssp() != get_scene_ssp())
    {
        LOG_INFO("Into sence_mode10_handle()\n");
        set_scene_last_ssp(get_scene_ssp());
        if(read_partition(MODE10_DATA+CNT_OFFEST,&logo_cnt,sizeof(u16)) == ESP_OK)
        {
            LOG_INFO("mode10 logo_cnt is %d\n",logo_cnt);
            if(read_partition(MODE10_DATA+FRAME_NUM,&frame_num,sizeof(u8)) == ESP_OK)
            {
                LOG_INFO("read mode10 frame num is %d\n",frame_num);

            }
            else
            {
                LOG_ERROR("mode10 frame read err\n");
            }
        }
        else
        {
            LOG_ERROR("mode10 cnt read err\n");
        }
        time = arch_os_ms_now();
        cnt =0;
    }

    if (arch_os_ms_elapsed(time)>=(1000/frame_num))
    {
        time = arch_os_ms_now();
        bzero(buf,BUF_SIZE);
        if (read_partition(MODE10_DATA+DATA_ADDR+cnt*get_color_length(),buf,get_color_length())==ESP_OK) //正确读取数据
        {
             disp_light_handle(buf);
        }
        cnt++;
    }

    if (cnt>=(logo_cnt-1))
    {
       cnt=0; //计数器清零
    }
}

void sence_mode11_handle()
{
    static int time= 0;
    static u16 logo_cnt; //读取的总计数量
    static u16 cnt; //计数器
    static u8 frame_num; //帧数
    u8 buf[BUF_SIZE]; //临时存储空间
    if (get_scene_last_ssp() != get_scene_ssp())
    {
        LOG_INFO("Into sence_mode11_handle()\n");
        set_scene_last_ssp(get_scene_ssp());
        if(read_partition(MODE11_DATA+CNT_OFFEST,&logo_cnt,sizeof(u16)) == ESP_OK)
        {
            LOG_INFO("mode11 logo_cnt is %d\n",logo_cnt);
            if(read_partition(MODE11_DATA+FRAME_NUM,&frame_num,sizeof(u8)) == ESP_OK)
            {
                LOG_INFO("read mode11 frame num is %d\n",frame_num);

            }
            else
            {
                LOG_ERROR("mode11 frame read err\n");
            }
        }
        else
        {
            LOG_ERROR("mode11 cnt read err\n");
        }
        time = arch_os_ms_now();
        cnt =0;
    }

    if (arch_os_ms_elapsed(time)>=(1000/frame_num))
    {
        time = arch_os_ms_now();
        bzero(buf,BUF_SIZE);
        if (read_partition(MODE11_DATA+DATA_ADDR+cnt*get_color_length(),buf,get_color_length())==ESP_OK) //正确读取数据
        {
             disp_light_handle(buf);
        }
        cnt++;
    }

    if (cnt>=(logo_cnt-1))
    {
       cnt=0; //计数器清零
    }
}

void sence_mode12_handle()
{
    static int time= 0;
    static u16 logo_cnt; //读取的总计数量
    static u16 cnt; //计数器
    static u8 frame_num; //帧数
    u8 buf[BUF_SIZE]; //临时存储空间
    if (get_scene_last_ssp() != get_scene_ssp())
    {
        LOG_INFO("Into sence_mode12_handle()\n");
        set_scene_last_ssp(get_scene_ssp());
        if(read_partition(MODE12_DATA+CNT_OFFEST,&logo_cnt,sizeof(u16)) == ESP_OK)
        {
            LOG_INFO("mode12 logo_cnt is %d\n",logo_cnt);
            if(read_partition(MODE12_DATA+FRAME_NUM,&frame_num,sizeof(u8)) == ESP_OK)
            {
                LOG_INFO("read mode12 frame num is %d\n",frame_num);

            }
            else
            {
                LOG_ERROR("mode12 frame read err\n");
            }
        }
        else
        {
            LOG_ERROR("mode12 cnt read err\n");
        }
        time = arch_os_ms_now();
        cnt =0;
    }

    if (arch_os_ms_elapsed(time)>=(1000/frame_num))
    {
        time = arch_os_ms_now();
        bzero(buf,BUF_SIZE);
        if (read_partition(MODE12_DATA+DATA_ADDR+cnt*get_color_length(),buf,get_color_length())==ESP_OK) //正确读取数据
        {
             disp_light_handle(buf);
        }
        cnt++;
    }

    if (cnt>=(logo_cnt-1))
    {
       cnt=0; //计数器清零
    }
}


void sence_group_mode1_handle() //组合场景1
{
    if (get_scene_last_ssp() != get_scene_ssp())
    {
        LOG_INFO("into group mode1\n");
        set_scene_last_ssp(get_scene_ssp());
        memcpy(&temp_scene_config.sence_config,&scene_local_data[get_scene_ssp()].sence_config,sizeof(LIGHT_EFFECT_T));
        set_light_effect_config(temp_scene_config.sence_config.light_effect_ssp,temp_scene_config.sence_config.wait,temp_scene_config.sence_config.len,temp_scene_config.sence_config.buf);
    }

    u8 buf[BUF_SIZE];
    bzero(buf,BUF_SIZE);
    get_cache_data(buf);
    disp_light_handle(buf);
}

void sence_group_mode2_handle() //组合场景2
{
    if (get_scene_last_ssp() != get_scene_ssp())
    {
        LOG_INFO("into group mode1\n");
        set_scene_last_ssp(get_scene_ssp());
        memcpy(&temp_scene_config.sence_config,&scene_local_data[get_scene_ssp()].sence_config,sizeof(LIGHT_EFFECT_T));
        set_light_effect_config(temp_scene_config.sence_config.light_effect_ssp,temp_scene_config.sence_config.wait,temp_scene_config.sence_config.len,temp_scene_config.sence_config.buf);
    }

    u8 buf[BUF_SIZE];
    bzero(buf,BUF_SIZE);
    get_cache_data(buf);
    disp_light_handle(buf);
}


void sence_group_mode3_handle() //组合场景3
{
    if (get_scene_last_ssp() != get_scene_ssp())
    {
        LOG_INFO("into group mode1\n");
        set_scene_last_ssp(get_scene_ssp());
        memcpy(&temp_scene_config.sence_config,&scene_local_data[get_scene_ssp()].sence_config,sizeof(LIGHT_EFFECT_T));
        set_light_effect_config(temp_scene_config.sence_config.light_effect_ssp,temp_scene_config.sence_config.wait,temp_scene_config.sence_config.len,temp_scene_config.sence_config.buf);
    }

    u8 buf[BUF_SIZE];
    bzero(buf,BUF_SIZE);
    get_cache_data(buf);
    disp_light_handle(buf);
}

void sence_group_mode4_handle() //组合场景4
{
    if (get_scene_last_ssp() != get_scene_ssp())
    {
        LOG_INFO("into group mode1\n");
        set_scene_last_ssp(get_scene_ssp());
        memcpy(&temp_scene_config.sence_config,&scene_local_data[get_scene_ssp()].sence_config,sizeof(LIGHT_EFFECT_T));
        set_light_effect_config(temp_scene_config.sence_config.light_effect_ssp,temp_scene_config.sence_config.wait,temp_scene_config.sence_config.len,temp_scene_config.sence_config.buf);
    }

    u8 buf[BUF_SIZE];
    bzero(buf,BUF_SIZE);
    get_cache_data(buf);
    disp_light_handle(buf);
}

void sence_group_mode5_handle() //组合场景5
{
    if (get_scene_last_ssp() != get_scene_ssp())
    {
        LOG_INFO("into group mode1\n");
        set_scene_last_ssp(get_scene_ssp());
        memcpy(&temp_scene_config.sence_config,&scene_local_data[get_scene_ssp()].sence_config,sizeof(LIGHT_EFFECT_T));
        set_light_effect_config(temp_scene_config.sence_config.light_effect_ssp,temp_scene_config.sence_config.wait,temp_scene_config.sence_config.len,temp_scene_config.sence_config.buf);
    }

    u8 buf[BUF_SIZE];
    bzero(buf,BUF_SIZE);
    get_cache_data(buf);
    disp_light_handle(buf);
}

void sence_group_mode6_handle() //组合场景6
{
    if (get_scene_last_ssp() != get_scene_ssp())
    {
        LOG_INFO("into group mode1\n");
        set_scene_last_ssp(get_scene_ssp());
        memcpy(&temp_scene_config.sence_config,&scene_local_data[get_scene_ssp()].sence_config,sizeof(LIGHT_EFFECT_T));
        set_light_effect_config(temp_scene_config.sence_config.light_effect_ssp,temp_scene_config.sence_config.wait,temp_scene_config.sence_config.len,temp_scene_config.sence_config.buf);
    }

    u8 buf[BUF_SIZE];
    bzero(buf,BUF_SIZE);
    get_cache_data(buf);
    disp_light_handle(buf);
}

void sence_group_mode7_handle() //组合场景7
{
    if (get_scene_last_ssp() != get_scene_ssp())
    {
        LOG_INFO("into group mode1\n");
        set_scene_last_ssp(get_scene_ssp());
        memcpy(&temp_scene_config.sence_config,&scene_local_data[get_scene_ssp()].sence_config,sizeof(LIGHT_EFFECT_T));
        set_light_effect_config(temp_scene_config.sence_config.light_effect_ssp,temp_scene_config.sence_config.wait,temp_scene_config.sence_config.len,temp_scene_config.sence_config.buf);
    }

    u8 buf[BUF_SIZE];
    bzero(buf,BUF_SIZE);
    get_cache_data(buf);
    disp_light_handle(buf);
}


void sence_group_mode8_handle() //组合场景8
{
    if (get_scene_last_ssp() != get_scene_ssp())
    {
        LOG_INFO("into group mode1\n");
        set_scene_last_ssp(get_scene_ssp());
        memcpy(&temp_scene_config.sence_config,&scene_local_data[get_scene_ssp()].sence_config,sizeof(LIGHT_EFFECT_T));
        set_light_effect_config(temp_scene_config.sence_config.light_effect_ssp,temp_scene_config.sence_config.wait,temp_scene_config.sence_config.len,temp_scene_config.sence_config.buf);
    }

    u8 buf[BUF_SIZE];
    bzero(buf,BUF_SIZE);
    get_cache_data(buf);
    disp_light_handle(buf);
}

void sence_group_mode9_handle() //组合场景9
{
    if (get_scene_last_ssp() != get_scene_ssp())
    {
        LOG_INFO("into group mode1\n");
        set_scene_last_ssp(get_scene_ssp());
        memcpy(&temp_scene_config.sence_config,&scene_local_data[get_scene_ssp()].sence_config,sizeof(LIGHT_EFFECT_T));
        set_light_effect_config(temp_scene_config.sence_config.light_effect_ssp,temp_scene_config.sence_config.wait,temp_scene_config.sence_config.len,temp_scene_config.sence_config.buf);
    }

    u8 buf[BUF_SIZE];
    bzero(buf,BUF_SIZE);
    get_cache_data(buf);
    disp_light_handle(buf);
}


void sence_group_mode10_handle() //组合场景10
{
    if (get_scene_last_ssp() != get_scene_ssp())
    {
        LOG_INFO("into group mode1\n");
        set_scene_last_ssp(get_scene_ssp());
        memcpy(&temp_scene_config.sence_config,&scene_local_data[get_scene_ssp()].sence_config,sizeof(LIGHT_EFFECT_T));
        set_light_effect_config(temp_scene_config.sence_config.light_effect_ssp,temp_scene_config.sence_config.wait,temp_scene_config.sence_config.len,temp_scene_config.sence_config.buf);
    }

    u8 buf[BUF_SIZE];
    bzero(buf,BUF_SIZE);
    get_cache_data(buf);
    disp_light_handle(buf);
}


void sence_group_mode11_handle() //组合场景11
{
    if (get_scene_last_ssp() != get_scene_ssp())
    {
        LOG_INFO("into group mode1\n");
        set_scene_last_ssp(get_scene_ssp());
        memcpy(&temp_scene_config.sence_config,&scene_local_data[get_scene_ssp()].sence_config,sizeof(LIGHT_EFFECT_T));
        set_light_effect_config(temp_scene_config.sence_config.light_effect_ssp,temp_scene_config.sence_config.wait,temp_scene_config.sence_config.len,temp_scene_config.sence_config.buf);
    }

    u8 buf[BUF_SIZE];
    bzero(buf,BUF_SIZE);
    get_cache_data(buf);
    disp_light_handle(buf);
}


void sence_group_mode12_handle() //组合场景12
{
    if (get_scene_last_ssp() != get_scene_ssp())
    {
        LOG_INFO("into group mode1\n");
        set_scene_last_ssp(get_scene_ssp());
        memcpy(&temp_scene_config.sence_config,&scene_local_data[get_scene_ssp()].sence_config,sizeof(LIGHT_EFFECT_T));
        set_light_effect_config(temp_scene_config.sence_config.light_effect_ssp,temp_scene_config.sence_config.wait,temp_scene_config.sence_config.len,temp_scene_config.sence_config.buf);
    }

    u8 buf[BUF_SIZE];
    bzero(buf,BUF_SIZE);
    get_cache_data(buf);
    disp_light_handle(buf);
}

